<template>
  <div class="hello">
    <h1>我是加法组件---{{ $store.state.age }}---{{$store.getters.myAge}}</h1>
    <button @click="addOne">+ 1</button>
    <button @click="addNum">+ n</button>
    <button @click="addOneAsync">async + 1</button>
    <button @click="addNumAsync">async + n</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
    }
  },
  methods: {
    addOne() {
      this.$store.commit('add')
    },
    addNum() {
      this.$store.commit('addN', 10)
    },
    addOneAsync() {
      this.$store.dispatch('addAsync')
    },
    addNumAsync() {
      this.$store.dispatch('addNAsync', 3)
    },
  }
}
</script>

<style scoped>

</style>
